package com.xing.game.netty.server;

import com.xing.game.netty.WorkerFactory;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.group.ChannelGroup;


public class NetServerPiplineFactory implements ChannelPipelineFactory {
	private WorkerFactory factory;
	private ChannelGroup group;

	public NetServerPiplineFactory(ChannelGroup group, WorkerFactory factory) {
		this.factory = factory;
		this.group = group;
	}

	@Override
	public ChannelPipeline getPipeline() throws Exception {
		ChannelPipeline pipeline = Channels.pipeline();
		pipeline.addLast("SERVER_PROCESSER", new NetServerHandler(group, factory));
		return pipeline;
	}
}
